package com.delivery.www.servlet;

import com.delivery.www.po.Seller;
import com.delivery.www.service.ServiceImpl.CouponServiceImpl;

import java.util.Scanner;
import java.util.concurrent.TimeUnit;

import static com.delivery.www.servlet.CouponPage.couponPage;

public class AddCoupon {
    public static void addCoupon(int storeId, Seller seller) {
        Scanner scanner = new Scanner(System.in);
        CouponServiceImpl couponService = new CouponServiceImpl();
        System.out.println("请输入你要设置的抵用券金额");
        int i1 = scanner.nextInt();
        System.out.println("请输入你使用抵用券的最低消费");
        int i2 = scanner.nextInt();
        boolean b = couponService.addCoupon(storeId, i1, i2);
        if (b) {
            System.out.println("增加成功！即将跳转");
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            couponPage(storeId, seller);
        }
    }
}
